'use strict';

const Service = require('egg').Service;

class CollectService extends Service {

  async getCollectList(biz) {

    const query = { biz};
    const opt =  {};
    const collectList = await this.ctx.model.Collect.find(query, {}, opt).exec();

    if (collectList.length === 0) {
      return [];
    }

    return collectList; 
  }


  newAndSave(title, biz) {
    
    const collect = new this.ctx.model.Collect();
    
    collect.title = title;
    collect.biz = biz;

    return collect.save();
  }
}


module.exports = CollectService;
